CFLAGS = -std=gnu99 -pedantic -Wextra -g
RPCGEN = rpcgen
RPCGENFLAGS = -C

SRV_OBJS = tftp_svc.o tftp_proc.o
CLI_OBJS = tftpclient.o tftp_clnt.o
SHR_OBJS = tftp_xdr.o
AUTO_GEN = tftp.h tftp_xdr.c tftp_svc.c tftp_clnt.c


all: tftpserver tftpclient

tftpserver: $(SRV_OBJS) $(SHR_OBJS)
	$(CC) $(CFLAGS) -o tftpserver $(SRV_OBJS) $(SHR_OBJS)

tftpclient: $(CLI_OBJS) $(SHR_OBJS)
	$(CC) $(CFLAGS) -o tftpclient $(CLI_OBJS) $(SHR_OBJS)

$(AUTO_GEN): tftp.x
	$(RPCGEN) $(RPCGENFLAGS) tftp.x

clean:
	$(RM) tftpserver $(SRV_OBJS)
	$(RM) tftpclient $(CLI_OBJS)
	$(RM) $(SHR_OBJS)
	$(RM) $(AUTO_GEN)
